home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / exec / remhead.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  93 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: remhead.c,v 1.7 1996/10/24 15:50:55 aros Exp $
  4.     $Log: remhead.c,v $
  5.     Revision 1.7  1996/10/24 15:50:55  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.6  1996/10/21 20:48:22  aros
  9.     Changed struct SysBase to struct ExecBase
  10.  
  11.     Revision 1.5  1996/08/13 13:56:06  digulla
  12.     Replaced AROS_LA by AROS_LHA
  13.     Replaced some AROS_LH*I by AROS_LH*
  14.     Sorted and added includes
  15.  
  16.     Revision 1.4  1996/08/01 17:41:16  digulla
  17.     Added standard header for all files
  18.  
  19.     Desc:
  20.     Lang: english
  21. */
  22. /* I want the macros */
  23. #define AROS_ALMOST_COMPATIBLE
  24. #include "exec_intern.h"
  25.  
  26. /*****************************************************************************
  27.  
  28.     NAME */
  29.     #include <exec/lists.h>
  30.     #include <clib/exec_protos.h>
  31.  
  32.     AROS_LH1I(struct Node *, RemHead,
  33.  
  34. /*  SYNOPSIS */
  35.     AROS_LHA(struct List *, list, A0),
  36.  
  37. /*  LOCATION */
  38.     struct ExecBase *, SysBase, 43, Exec)
  39.  
  40. /*  FUNCTION
  41.     Remove the first node from a list.
  42.  
  43.     INPUTS
  44.     list - Remove the node from this list
  45.  
  46.     RESULT
  47.     The node that has been removed.
  48.  
  49.     NOTES
  50.  
  51.     EXAMPLE
  52.     struct List * list;
  53.     struct Node * head;
  54.  
  55.     // Remove node and return it
  56.     head = RemHead (list);
  57.  
  58.     BUGS
  59.  
  60.     SEE ALSO
  61.  
  62.     INTERNALS
  63.  
  64.     HISTORY
  65.     26-08-95    digulla created after EXEC-Routine
  66.     26-10-95    digulla adjusted to new calling scheme
  67.  
  68. ******************************************************************************/
  69. {
  70.     AROS_LIBFUNC_INIT
  71.     struct Node * node;
  72.  
  73.     assert (list);
  74.     /*
  75.     Unfortunately, there is no (quick) check that the node
  76.     is in a list
  77.     */
  78.  
  79.     /* Get the address of the first node or NULL */
  80.     node = list->lh_Head->ln_Succ;
  81.     if (node)
  82.     {
  83.     node->ln_Pred = (struct Node *)list;
  84.     node = list->lh_Head;
  85.     list->lh_Head = node->ln_Succ;
  86.     }
  87.  
  88.     /* Return the address or NULL */
  89.     return node;
  90.     AROS_LIBFUNC_EXIT
  91. } /* RemHead */
  92.  
  93.